<!DOCTYPE html>
<html>
	<head>
		{template head}
	</head>
	<body class="bg">
		<section class="header">
			<a href="javascript:history.back();">
				<img src="{SITE_THEME}img/left.png">
			</a>
			<h3>收银台</h3>
		</section>
		<section class="og">
			<h3>正在购买六个月特权卡</h3>
			<p>购买后六个月可免费查看招聘应聘信息</p>
		</section>
		<section class="odata">
			<div class="oli">
				<label>订单编号</label>
				<span>{$data['ordersn']}</span>
			</div>
			<div class="oli">
				<label>订单金额</label>
				<span class="color">￥{$data['jine'];}</span>
			</div>
		</section>
		<section class="space-8"></section>
		<section class="pli">
			<a href="javascript:;" onclick="callpay()">
			<img src="{SITE_THEME}img/wei.png" class="icon">
			<span>
				<h3>微信支付</h3>
				<p>微信安全支付</p>
			</span>
			<img src="{SITE_THEME}img/right.png" class="right">
			</a>
		</section>
	</body>
</html>
<script>
    //调用微信JS api 支付
    function jsApiCall()
    {
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest',
            {$jsApiParameters},
            function(res){
                WeixinJSBridge.log(res.err_msg);
                //支付成功
//                alert(res.err_code+res.err_desc+res.err_msg);
                if(res.err_msg == 'get_brand_wcpay_request:ok') {
                    layer.msg('支付成功',{end:function(){
                        window.location.href="index.php?c=weixin_pay&a=pay_ok&ordersn={$data[ordersn]}&jine={$data[jine]}";
                    }});
                }
                else{//支付失败
                    layer.msg('支付失败!',{end:function(){window.location.href="index.php?c=order";}});
                }
            }
        );
    }

    function callpay()
    {
        if (typeof WeixinJSBridge == "undefined"){
            if( document.addEventListener ){
                document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
            }else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
            }
        }else{
            jsApiCall();
        }
    }
</script>
